<?php
namespace app\api\controller\xiluedu;


use app\common\controller\Api;
use app\common\model\xiluedu\CourseOrder AS CourseOrderModel;
use think\Exception;

class CourseOrder extends Api
{
    protected $noNeedRight = ['*'];

    public function lists(){

        $this->success('查询成功',CourseOrderModel::lists($this->request->param(''),$this->auth->id));

    }

    public function detail(){
        $order_id = $this->request->param('order_id');
        $this->success('查询成功',CourseOrderModel::detail($order_id));

    }
    /**
     * 创建订单及支付
     */
    public function sure(){
        $params = $this->request->param('');

        try {
            $ret = CourseOrderModel::sure($params);
        }catch (Exception $e){
            $this->error($e->getMessage());
        }
        $this->success('查询成功',$ret);
    }

    /**
     * 创建订单及支付
     */
    public function create_order(){
        $params = $this->request->param('');
        try {
            $result = CourseOrderModel::createOrder($params);
        }catch (Exception $e){
            $this->error($e->getMessage());
        }
        $this->success('创建订单成功',$result);
    }


}